import { JSEncrypt } from 'jsencrypt'

export function encode(rawStr) {
  const rsaPublKey = `MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANnnDPO0AmHQpca1KTz/oEyGVMfZfvPAirZ2pctoSDdM1vmkkX8lfBIl5H0k5hFt+fR3v/b7OG02O5ShqGrluL8CAwEAAQ==`
  const encryptor = new JSEncrypt() // 新建JSEncrypt对象
  encryptor.setPublicKey(rsaPublKey) // 设置公钥
  const passwordEncryp = encryptor.encrypt(rawStr) // 对密码进行加密
  console.log(passwordEncryp)
  return passwordEncryp
}
